package com.xy.blog.article.domain.dao.mapper;

import com.xy.blog.article.domain.dao.model.ArticleDO;
import com.xy.blog.core.mybatis.mapper.BaseCommonMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zanhonglei
 * @version V1.0
 * @Description:
 * @date 2019/11/2 14:16
 */
@Mapper
public interface ArticleMapper extends BaseCommonMapper<ArticleDO> {
//public interface ArticleMapper extends ElasticsearchRepository<ArticleDO, String> {

    @Select(" select id,title,type,create_time as createTime from t_article ORDER BY create_time desc  ")
    List<ArticleDO> blogHomeList();


    @Select(" select max(a.orders) from t_article a , t_article_category_rel b where a.id = b.article_id  and b.category_id = #{id} ")
    Integer getMaxOrderByCategoryId(Long id);

    @Select(" select max(a.orders) from t_article a , t_article_special_column_rel b where a.id = b.article_id  and b.special_column_id = #{id} ")
    Integer getMaxOrderBySpecialColumnId(Long id);


}
